import { request } from 'ice';

export interface QueryParams {
  /** 订单号 */
  orderNo?: string;
  // 物流状态
  shippingStatus?: number;
  /** 发货时间 开始 */
  startTime?: number;
  /** 发货时间 截止 */
  endTime?: number;
  // 发货时间
  deliveryTime?: number[];
}

/** 退货列表 */
export const myReturnList = (pageParams: ICommon.PageParams, formData: QueryParams): Promise<any> => {
  const params = {
    ...pageParams,
    ...formData,
    startTime: (formData?.deliveryTime || [])[0]?.valueOf(),
    endTime: (formData?.deliveryTime || [])[1]?.valueOf(),
    deliveryTime: undefined,
  };
  return request.get('/logistics/seller/send/return/page', { params }).then((res) => ({
    total: res?.total || 0,
    list: res?.data || [],
  }));
};
